﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Browser;

namespace Manas.Silverlight.DynamicDeepZoom.TileSources
{
    public class DynamicTileSource : MultiScaleTileSource
    {
 
        /// <summary>
        /// Create a new instance of the tile source 
        /// </summary>
        /// <param name="config"></param>
        public DynamicTileSource(IConfiguration config)
            : base(config.ImageWidth, config.ImageHeight, config.TileWidth, config.TileHeight, 0)
        {
        }

        protected override void GetTileLayers(int tileLevel, int tilePositionX, int tilePositionY, System.Collections.Generic.IList<object> tileImageLayerSources)
        {
            var builder = new UriBuilder(HtmlPage.Document.DocumentUri);
            builder.Path = string.Format("Tiles/Tile/{0}/{1}/{2}", tileLevel, tilePositionX, tilePositionY);
            tileImageLayerSources.Add(builder.Uri);
        }
    }
}
